function ConvertTo-CSVList {
    [CmdletBinding()]
    param (
        [Parameter(ValueFromPipeline)][string[]]$Arr
    )
 
    begin {
        $allItems = @()
    }

    process {
        $allItems += $Arr
    }

    end {
        $itemsWithSingleQuotes = $allItems | ForEach-Object { "`'$_`'" }
        return $itemsWithSingleQuotes -join ', '
    }

    <#
    .SYNOPSIS
        Array -> CSV string.
    .DESCRIPTION
        Turns an array of items into a string of comma-seperated items.
        Each item is enclosed in single quotes.
    .EXAMPLE
        PS C:\> @('item1','item2','item3') | ConvertTo-CSVList

        'item1', 'item2', 'item3'
    .INPUTS
        [string[]].
    .OUTPUTS
        [string]
    .PARAMETER Arr
        Array of strings.
        Required?                    false
        Position?                    
        Default value                
        Accept pipeline input?       true
        Accept wildcard characters?  false
    #>
}